<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('firstups', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('sdk激活');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('package_id')->comment('包id')->unsigned()->default(0);
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->integer('channel')->comment('渠道ID')->unsigned()->default(0);

            $table->string('ip', 64)->comment('ip')->default('');
            $table->string('net_work', 64)->comment('使用的网络')->default('');
            $table->string('sdk_version', 32)->comment('sdk版本')->default('');

            $table->tinyInteger('device_type')->comment('设备类型 1android 2ios')->unsigned()->default(0);
            $table->string('device_factory', 32)->comment('机型厂商 如 vivo ipone')->default('');
            $table->string('device_os', 32)->comment('设备机型 如 iPhone14')->default('');
            $table->string('device_system', 32)->comment('设备系统版本 如 16.5')->default('');
            $table->integer('device_screen_w')->comment('设备的屏幕分辨率-宽')->unsigned()->default(0);
            $table->integer('device_screen_h')->comment('设备的屏幕分辨率-高')->unsigned()->default(0);

            $table->string('device_num', 32)->comment('自定义唯一id')->default('');
            $table->string('idfa', 64)->comment('ios idfa')->default('');
            $table->string('idfv', 64)->comment('ios idfv')->default('');
            $table->string('imei', 64)->comment('android imei')->default('');
            $table->string('android_id', 64)->comment('google广告id')->default('');
            $table->string('google_adid', 64)->comment('android id')->default('');
            $table->string('oaid', 64)->comment('oaid')->default('');

            $table->index('create_time');
            $table->index('game_id');
            $table->index('package_id');
            $table->index('channel');
            $table->index('ip');

            $table->index('device_type');
            $table->index('device_num');
            $table->index('idfa');
            $table->index('idfv');
            $table->index('imei');
            $table->index('android_id');
            $table->index('google_adid');
            $table->index('oaid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('firstups');
    }
};
